/* test_panel.cc
* This file is part of ncursesxx library
* Copyright (c) 2003,2004 by Stanislav Ievlev
*
* This file is covered by the GNU Library General Public License,
* which should be included with libncursesxx as the file COPYING.
*/
#include <iostream>
#include <stdexcept>

#include <ncurses/application.hh>
#include <ncurses/color.hh>
#include <ncurses/pen.hh>
#include <ncurses/panel.hh>


int main()
{
	ncurses::application	app;

	ncurses::color	blue_grey(COLOR_BLUE, COLOR_WHITE, A_BOLD);
	ncurses::color	red_blue(COLOR_RED, COLOR_BLUE, A_BOLD);

	//second panel
	ncurses::panel panel2;
	ncurses::pen pen2(panel2);

	panel2.move(3, 3);
	panel2.resize(app.width() / 3, app.height() / 2);
	pen2.fill(blue_grey);
	pen2.frame();

	ncurses::panel panel1;
	ncurses::pen pen1(panel1);

	panel1.move(1, 1);
	panel1.resize(app.width() / 3, app.height() / 2);
	pen1.fill(blue_grey);
	pen1.frame();


	//subpanel on the second panel
	ncurses::panel subpanel2(&panel2);
	ncurses::pen subpen2(subpanel2);
	subpanel2.move(panel2.width() / 8, panel2.height() / 8);
	subpanel2.resize(app.width() / 8, app.height() / 4);
	subpen2.fill(red_blue);
	subpen2.frame();

	panel2.show();
	panel1.show();

	::update_panels();
	::doupdate();

	::wgetch(::stdscr);

	panel2.top();

	::update_panels();
	::doupdate();

	::wgetch(::stdscr);

	panel2.move(3, -1); //move using relative coords
	::update_panels();
	::doupdate();
	
	::wgetch(::stdscr);
	
	panel2.move(app.width() / 2, app.height() / 2, ncurses::absolute); //move using absolute coords
	::update_panels();
	::doupdate();
	
	::wgetch(::stdscr);
}

